﻿namespace WMS6.Web.TaskMgmt
{
    using System;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;

    public class UserLicenseQuery : BasePage
    {
        protected Button btnExport;
        protected Button btnList;
        protected Button btnNew;
        protected Button btnSearch;
        protected DropDownList ddlEquipmentProfileIDOper;
        protected DropDownList ddlTaskStrategyIDOper;
        protected DropDownList ddlUserGroupOper;
        protected DropDownList ddlUserIDOper;
        protected HtmlForm F6040;
        protected HtmlInputHidden hdnActionID;
        protected HtmlHead Head1;
        protected Label lblEquipmentProfileID;
        protected Label lblTaskStrategyID;
        protected Label lblUserGroup;
        protected Label lblUserID;
        protected Label lblUserLicenseQuery;
        protected HtmlLink mycss;
        protected TextBox txtEquipmentProfileID;
        protected TextBox txtTaskStrategyID;
        protected TextBox txtUserGroup;
        protected TextBox txtUserID;

        protected void btnList_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("UserLicenseList.aspx?action={0}&from=list", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("UserLicenseList.aspx?action={0}", base.UrlEncode(this.hdnActionID.Value.Trim())), false);
        }

        private void InitDropDownLists()
        {
            base.InitQueryDDL(this.ddlEquipmentProfileIDOper, 0);
            base.InitQueryDDL(this.ddlTaskStrategyIDOper, 0);
            base.InitQueryDDL(this.ddlUserGroupOper, 0);
            base.InitQueryDDL(this.ddlUserIDOper, 0);
        }

        private void LoadData()
        {
            if (!string.IsNullOrEmpty(base.Request.QueryString["action"]))
            {
                this.btnNew.Visible = false;
                this.btnExport.Visible = false;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
                this.InitDropDownLists();
            }
        }

        public string EquipmentProfileID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtEquipmentProfileID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtEquipmentProfileID.Text.Trim(), this.ddlEquipmentProfileIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string TaskStrategyID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtTaskStrategyID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtTaskStrategyID.Text.Trim(), this.ddlTaskStrategyIDOper.SelectedValue);
                }
                return "";
            }
        }

        public string UserGroup
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtUserGroup.Text.Trim()))
                {
                    return base.GetParamsString(this.txtUserGroup.Text.Trim(), this.ddlUserGroupOper.SelectedValue);
                }
                return "";
            }
        }

        public string UserID
        {
            get
            {
                if (!string.IsNullOrEmpty(this.txtUserID.Text.Trim()))
                {
                    return base.GetParamsString(this.txtUserID.Text.Trim(), this.ddlUserIDOper.SelectedValue);
                }
                return "";
            }
        }
    }
}

